<include file="Public/min-header"/>
<div class="wrapper">
    <include file="Public/breadcrumb"/>
    <style>
        #fenlei_box{border: 1px solid #3297ff;position: absolute;width:450px;height:250px;overflow:hidden; z-index:9999;background:#fff;display:none;}
        #fenlei_box li{list-style: none;color:#3297ff;text-align:left;margin-left:-20px;line-height: 32px;cursor: pointer;border-bottom:1px dashed}
        #store_box{border: 1px solid #3297ff;position: absolute;width:450px;height:250px;overflow:hidden; z-index:9999;background:#fff;display:none;}
        #store_box li{list-style: none;color:#3297ff;text-align:left;margin-left:-20px;line-height: 32px;cursor: pointer;border-bottom:1px dashed}
        #teshu{display: none;color:red;}
    </style>
    <section class="content">
        <!-- Main content -->
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i>添加余额</h3>
                </div>
                <div class="panel-body">
                    <!-- <span style="color: red;">此功能升级中，请稍候再试。。。</span> -->
                    <!--表单数据-->
                    <form method="post" action="{:U('Finance/add_money')}" id="order-add">
                        <div class="tab-pane" >
                            <table class="table table-bordered">
                                <tbody>
                                <tr>
                                    <td>客户:</td>
                                    <td>
                                        <div class="form-group ">
                                            <div class="col-xs-4">
                                                <input name="user_name" id="user_name" class="form-control" value="" placeholder="客户公司名/手机号码搜索" oninput="kehu_sousuo($(this))" autocomplete="off"/>
                                                <ul id="fenlei_box">
                                                </ul>
                                                <input type="hidden" name="user_id" id="user_id" value="0"/>
                                            </div>
                                            <div class="col-xs-5">
                                                <span style="color:green;display: none;" id="add_user">该用户可以添加</span>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>增加金额:</td>
                                    <td>
                                        <div class="form-group ">
                                            <div class="col-xs-1">
                                                <input class="form-control"   name="money" value=""/>
                                            </div>
                                        </div>
                                    </td>
                                </tr>

                                <tr>
                                    <td>备注:</td>
                                    <td>
                                        <div class="form-group ">
                                            <div class="col-xs-8">
                                                <input class="form-control"   name="remark" value=""/>
                                            </div>
                                        </div>
                                    </td>
                                </tr>

                                </tbody>
                            </table>
                        </div>
                        <input type="hidden" name="id" value="{$order.order_id}">
                        <button class="btn btn-info" type="button" onclick="checkSubmit()">
                            <i class="ace-icon fa fa-check bigger-110"></i>
                            保存
                        </button>
                    </form>
                    <!--以下是在线编辑器 代码 -->

                    <script>

                        function checkSubmit()
                        {
                            $('#order-add').submit();
                        }
                    </script>
                </div>
            </div>

        </div>    <!-- /.content -->
    </section>
</div>
<script>


    function kehu_sousuo(obj)
    {
        var value = obj.val();
        if($.trim(user_name) == '')
            return false;

        var dai_type=$("input[type='radio']:checked").val();
        $.ajax({
            type : "POST",
            url:"/index.php?m=admin&c=User&a=search_user2",//+tab,
            data :{search_key:value},
            success: function(data){
                data=JSON.parse(data);
                if(data.code=='200'){
                    $('#fenlei_box').show(200);
                    $('#add_user').hide(100);
                    $('#fenlei_box').html(data.selects);
                }else{
                    $('#fenlei_box').hide(100);
                    if(dai_type==1)
                        $('#add_user').show(200);

                    $('#fenlei_box').html('');
                }
            }
        });
    }

    /* 用户客户选择 layer.msg('该用户不是本商城审核会员！不能代其下单。', {icon: 5});*/
    $(document).ready(function(){
        $("body").on("click", function() {
            $('#fenlei_box').hide(100);
            $('#store_box').hide(100);
        });

        $("#fenlei_box").on("click","li", function() {
            var user_id=$(this).attr('rel'),
                consignee=$(this).attr('alt'),
                address=$(this).attr('class'),
                company=$(this).attr('title'),
                biaoshi_xian=$(this).attr('id'),
                shouji=$(this).attr('rev');

            $('#consignee').val(consignee);
            $('#address').val(address);
            $('#mobile').val(shouji);
            $('#biaoshi_xian').val(biaoshi_xian);
            $('#user_name').val(company);
            $('#user_id').val(user_id);
        });
    })


</script>
</body>
</html>